<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增内置函数')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-function-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">函数名称：</label>
                <div class="col-sm-8">
                    <input name="functionName" class="form-control" type="text" required placeholder="英文字母、数字、下划线组成">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">函数类型：</label>
                <div class="col-sm-8">
                	<select name="functionType" class="form-control m-b" required th:with="type=${@dict.getType('trans_function_type')}">
							<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
					</select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">JAVA类名：</label>
                <div class="col-sm-8">
                    <input name="classsName" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">JAVA包名：</label>
                <div class="col-sm-8">
                    <input name="libName" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">JAVA方法名：</label>
                <div class="col-sm-8">
                    <input name="methodName" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">参数类型列表：</label>
                <div class="col-sm-8">
                    <textarea name="parameterList" class="form-control" placeholder="请用 , 分割。String,java.math.BigDecimal,..."></textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">返回值类型：</label>
                <div class="col-sm-8">
                	<input name="returnType" class="form-control" type="text" required placeholder="无返回值用void">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "metadata/function"
        
        $("#form-function-add").validate({
           	onkeyup: false,
        	rules:{
        		functionName:{
        			codeRule: true
        		}
        	},
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-function-add').serialize());
            }
        }
    </script>
</body>
</html>